package com.qen.interfaces;

import com.qen.common.FillUtils;
import com.qen.wrapper.LambdaWrapper;

/**
 * @author licz
 * @data 2025年06月04日 3:13 PM
 */
public interface Fill<Children> {

    Children addFill(MConsumer<Object> consumer);

    default <R> Children fill(SFunction<R, ?> field, SFunction<R, ?> tagField) {
        return addFill(c -> FillUtils.fill(c, field, tagField));
    }

    default <T, X> Children fill(SFunction<T, ?> field, SFunction<T, X> tagField, MConsumer<LambdaWrapper<X>> consumer) {
        return addFill(c -> FillUtils.fill(c, field, tagField, (MConsumer<LambdaWrapper<?>>) ((Object) consumer)));
    }

    default <T, X> Children fill(SFunction<T, ?> field, Class<X> oneClass, SFunction<T, ?> tagField) {
        return addFill(c -> FillUtils.fill(c, field, oneClass, tagField));
    }

    default <T, X> Children fill(SFunction<T, ?> field, Class<X> oneClass, SFunction<T, ?> tagField, MConsumer<LambdaWrapper<X>> consumer) {
        return addFill(c -> FillUtils.fill(c, field, oneClass, tagField, (MConsumer<LambdaWrapper<?>>) ((Object) consumer)));
    }

    default <T, X> Children fill(SFunction<T, ?> field, SFunction<X, ?> oneField, SFunction<T, ?> tagField) {
        return addFill(c -> FillUtils.fill(c, field, oneField, tagField));
    }

    default <T, X> Children fill(SFunction<T, ?> field, SFunction<X, ?> oneField, SFunction<T, ?> tagField, MConsumer<LambdaWrapper<X>> consumer) {
        return addFill(c -> FillUtils.fill(c, field, oneField, tagField, (MConsumer<LambdaWrapper<?>>) ((Object) consumer)));
    }
}
